home *** CD-ROM | disk | FTP | other *** search
- Path: comma.rhein.de!serpens!not-for-mail
- From: mlelstv@serpens.rhein.de (Michael van Elst)
- Newsgroups: comp.sys.amiga.programmer
- Subject: FPU: What am I doing wrong???
- Date: 18 Mar 1996 23:58:28 +0100
- Organization: dis-
- Message-ID: <4ikpqk$ds@serpens.rhein.de>
- NNTP-Posting-Host: serpens.rhein.de
-
- I'm posting this for Chuck Davis (roshicorp@roshi.corp.earthlink.net),
- please reply to him directly.
- ____________________________________________________________________
-
-
- I wonder if you might know what's happening that I don't seem to
- understand? This is my first experience in trying to use the FPU.
- The DFT routines are three versions of the same thing.
- I'm using PhxAss for all three assemblies.
-
- CPU 68030
- FPU
-
- The first version works but, of course, is too slow as it is
- used in an _interrupt_ routine and each interrupt is 8ms.
- 128 sample/sec. This used the ascii version of the sin/cos
- routines converted for FFP.
-
- In the second routine, I'm trying to get at the FPU via the IEEE
- libraries. Immediate crash! Guru# 8000 000D ???
-
- In the third routine, I'm trying to use pure FPU code. Of course,
- this would be the most ideal routine to use. Again GURU# 8000 000D
-
- I think I've checked the FPU with AIBB 5.0. The performance seems
- to be what I'm looking for and is much much better than when I finally
- installed the FPU a week ago. A1200 / GVP 030 + 68882 @ 50mHz. OS3.1
-
- Is there something extra or special that I seem to be missing????
- I would surely hate to have to go to the '060 [Blizzard 1260] and FFP :(
-
- Thank you very much,
-
- Best regards,
-
- ;--------------------------------------------------------------
- * Version #1
-
- move.l _MathBase,a6
- jsr _LVOSPFlt(a6)
- move.l d0,DR
- move.l d0,DI
-
- lea XRlft,a1
- lea XIlft,a2
- lea CosFFP,a4
- lea SinFFP,a5
-
- moveq #$20,d7 ; FOR I=0 TO 32
- LOOP1:
- move.l (a1),d0
- move.l DR,d1
- jsr _LVOSPAdd(a6)
- move.l d0,d5 ; TR=XR(I)+DR
-
- move.l (a2),d0
- move.l DI,d1
- jsr _LVOSPAdd(a6)
- move.l d0,d6 ; TI=XI(I)+DI
-
- ; a TR in d1
- ; c TI in d2
- move.l (a4)+,d3 ; b ER(I)
- move.l (a5)+,d4 ; d EI(I)
-
- move.l d5,d0
- move.l d4,d1
- jsr _LVOSPMul(a6)
- move.l d0,WT ; EI(I)*TR
-
- move.l d6,d0
- move.l d4,d1
- jsr _LVOSPMul(a6)
- move.l d0,XT ; EI(I)*TI
-
- move.l d5,d0
- move.l d3,d1
- jsr _LVOSPMul(a6)
- move.l d0,YT ; ER(I)*TR
-
- move.l d6,d0
- move.l d3,d1
- jsr _LVOSPMul(a6)
- move.l d0,ZT ; ER(I)*TI
-
- move.l YT,d0
- move.l XT,d1
- jsr _LVOSPSub(a6)
- move.l d0,(a1)+ ; XR(I)=ER(I)*TR-EI(I)*TI
-
- move.l WT,d0
- move.l ZT,d1
- jsr _LVOSPAdd(a6)
- move.l d0,(a2)+ ; XI(I)=ER(I)*TI+EI(I)*TR
-
- dbf d7,LOOP1
-
- ;--------------------------------------------------------
-
- movea.l _MathIEEESingBase,a6
- jsr _LVOIEEESPFlt(a6)
- move.l d0,DR
- move.l d0,DI
-
- lea XRlft,a1
- lea XIlft,a2
- lea SPCos,a4
- lea SPSin,a5
-
- moveq #$20,d7 ; FOR I=0 TO 32
- LOOP1:
- move.l (a1),d0
- move.l DR,d1
- jsr _LVOIEEESPAdd(a6)
- move.l d0,d5 ; TR=XR(I)+DR
-
- move.l (a2),d0
- move.l DI,d1
- jsr _LVOIEEESPAdd(a6)
- move.l d0,d6 ; TI=XI(I)+DI
-
- ; a TR in d1
- ; c TI in d2
- move.l (a4)+,d3 ; b ER(I)
- move.l (a5)+,d4 ; d EI(I)
-
- move.l d5,d0
- move.l d4,d1
- jsr _LVOIEEESPMul(a6)
- move.l d0,WT ; EI(I)*TR
-
- move.l d6,d0
- move.l d4,d1
- jsr _LVOIEEESPMul(a6)
- move.l d0,XT ; EI(I)*TI
-
- move.l d5,d0
- move.l d3,d1
- jsr _LVOIEEESPMul(a6)
- move.l d0,YT ; ER(I)*TR
-
- move.l d6,d0
- move.l d3,d1
- jsr _LVOIEEESPMul(a6)
- move.l d0,ZT ; ER(I)*TI
-
- move.l YT,d0
- move.l XT,d1
- jsr _LVOIEEESPSub(a6)
- move.l d0,(a1)+ ; XR(I)=ER(I)*TR-EI(I)*TI
-
- move.l WT,d0
- move.l ZT,d1
- jsr _LVOIEEESPAdd(a6)
- move.l d0,(a2)+ ; XI(I)=ER(I)*TI+EI(I)*TR
-
- dbf d7,LOOP1
-
- ***********************************************************
-
- lea XRlft,a1
- lea XIlft,a2
- lea SPCos,a5
- lea SPSin,a6
-
- fmove.l d0,fp0
-
- moveq #$20,d7 ; FOR I=0 TO 32
- LOOP1:
- fmove.s (a1),fp1
- fadd.s fp0,fp1 ; TR=XR(I)+DR
- fmove.s (a2),fp2
- fadd.s fp0,fp2 ; TI=XI(I)+DI
-
- ; a TR in d1
- ; c TI in d2
- fmove.s (a5)+,fp3 ; b ER(I)
- fmove.s (a6)+,fp4 ; d EI(I)
-
- fmove.s fp1,fp5
- fmove.s fp2,fp6
-
- fsglmul fp4,fp1 ; TR*EI(I)
- fsglmul fp4,fp2 ; TI*EI(I)
- fsglmul fp3,fp5 ; TR*ER(I)
- fsglmul fp3,fp6 ; TI*ER(I)
-
- fsub.s fp2,fp5 ; ER(I)*TI-EI(I)*TR
- fadd.s fp1,fp6 ; ER(I)*TR+EI(I)*TI
-
- fmove.s fp5,(a1)+ ; XR(I)=ER(I)*TI-EI(I)*TR
- fmove.s fp6,(a2)+ ; XI(I)=ER(I)*TR+EI(I)*TI
-
- dbf d7,LOOP1
-
- ************************************************************
-
- SPCos:
- dc.s 1.000000
- dc.s .9951847
- dc.s .9807853
- dc.s .9569404
- dc.s .9238795
- dc.s .8819213
- dc.s .8314696
- dc.s .7730104
- dc.s .7071067
- dc.s .6343933
- dc.s .5555701
- dc.s .4713967
- dc.s .3826835
- dc.s .2902847
- dc.s .1950903
- dc.s 9.801716-E02
- dc.s -1.192093-E07
- dc.s -9.801722-E02
- dc.s -.1950903
- dc.s -.2902848
- dc.s -.3826835
- dc.s -.4713968
- dc.s -.5555705
- dc.s -.6343932
- dc.s -.7071067
- dc.s -.7730105
- dc.s -.8314697
- dc.s -.8819214
- dc.s -.9238797
- dc.s -.9569404
- dc.s -.9807854
- dc.s -.9951848
- dc.s -1.000000
- dc.s -.9951845
- dc.s -.9807854
- dc.s -.9569402
- dc.s -.9238795
- dc.s -.8819212
- dc.s -.8314697
- dc.s -.7730105
- dc.s -.7071067
- dc.s -.6343933
- dc.s -.5555701
- dc.s -.4713968
- dc.s -.382683
- dc.s -.2902845
- dc.s -.1950903
- dc.s -9.801686-E02
- dc.s -1.192093-E07
- dc.s 9.801728-E02
- dc.s .1950904
- dc.s .2902851
- dc.s .3826836
- dc.s .4713967
- dc.s .5555704
- dc.s .6343933
- dc.s .707107
- dc.s .7730106
- dc.s .8314695
- dc.s .8819214
- dc.s .9238795
- dc.s .9569404
- dc.s .9807853
- dc.s .9951848
-
- SPSin:
- dc.s 0
- dc.s 9.801714-E02
- dc.s .1950903
- dc.s .2902847
- dc.s .3826835
- dc.s .4713967
- dc.s .5555702
- dc.s .6343933
- dc.s .7071068
- dc.s .7730104
- dc.s .8314697
- dc.s .8819213
- dc.s .9238795
- dc.s .9569404
- dc.s .9807854
- dc.s .9951847
- dc.s 1.000000
- dc.s .9951847
- dc.s .9807853
- dc.s .9569404
- dc.s .9238795
- dc.s .8819212
- dc.s .8314695
- dc.s .7730105
- dc.s .7071068
- dc.s .6343933
- dc.s .5555702
- dc.s .4713966
- dc.s .3826833
- dc.s .2902847
- dc.s .1950903
- dc.s 9.801709-E02
- dc.s -8.742791-E08
- dc.s -9.801726-E02
- dc.s -.1950905
- dc.s -.2902849
- dc.s -.3826835
- dc.s -.4713968
- dc.s -.5555703
- dc.s -.6343933
- dc.s -.7071068
- dc.s -.7730104
- dc.s -.8314698
- dc.s -.8819213
- dc.s -.9238797
- dc.s -.9569404
- dc.s -.9807853
- dc.s -.9951848
- dc.s -1.000000
- dc.s -.9951847
- dc.s -.9807853
- dc.s -.9569402
- dc.s -.9238795
- dc.s -.8819213
- dc.s -.8314695
- dc.s -.7730104
- dc.s -.7071065
- dc.s -.6343932
- dc.s -.5555703
- dc.s -.4713966
- dc.s -.3826835
- dc.s -.2902844
- dc.s -.1950902
- dc.s -9.801676-E02
-
- --
- .-. .-.
- / \ .-. .-. / \
- / \ / \ .-. _ .-. / \ / \
- -/--Chuck Davis -------\-----/---\---/-\---/---\-----/-----\-------/-------\--
- roshicorp@roshi.corp.earthlink.net `-' \ / \ /
- \ / `-' `-' \ /
- `-' `-'
-
-
-
- --
- Michael van Elst
-
- Internet: mlelstv@serpens.rhein.de
- "A potential Snark may lurk in every tree."
-